<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>魏远商城</title>
		<meta name="viewport" content="initial-scale=1, maximum-scale=1">
		<link rel="shortcut icon" href="/favicon.ico">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" type="text/css" href="css/categroygoods.css" />
		<link rel="stylesheet" href="css/my-order.css" />
		<link rel="stylesheet" href="css/style.css" />
	</head>

	<body style="background: white;">
		<header class="bar bar-nav return-header" style="width: 100%;">
			<span class="order-back mui-action-back"><img src="img/back-le.png" height="50%"/></span>
			<h1 class="title" style="line-height: 2.2rem;">产品</h1>
		</header>
		<div class="categroy-wrap">
			<!--<div class="categroy-signal">
				<div class="categroy-signal-con">
					<div style="background-image: url(img/banner7_21.png);"></div>
					<div>
						<span class="categroy-name">东红奇异果</span><br />
						<span class="categroy-discor">红心朝天，人人爱吃</span><br />
						<span class="price">￥<span class="pricereal">192.00</span></span>
					</div>
				</div>
			</div>
			
			<div class="categroy-signal">
				<div class="categroy-signal-con">
					<div style="background-image: url(img/banner7_21.png);"></div>
					<div>
						<span class="categroy-name">东红奇异果</span><br />
						<span class="categroy-discor">红心朝天，人人爱吃</span><br />
						<span class="price">￥<span class="pricereal">192.00</span></span>
					</div>
				</div>
			</div>-->
			
			
		</div>
		<script src="js/jquery-3.1.1.min.js"></script>
		<script src="js/mui.min.js"></script>
		<script src="js/url.js"></script>
		<script type="text/javascript">
               
               
			erji();
				function erji() {
					$('.title').text(localStorage.whereclasstext);
					$.ajax({
						url: ur + '/mobile/product/getProductListByCategoryId',
						type: 'post',
						dataType: 'json',
						data: {
							'categoryId': localStorage.whereclassId,
						},
						success: function(data) {
							//							console.log(data);
							//							console.log(JSON.stringify(data) + '加载二丶三级分类背景')
							//						console.log(data.result.data[0].mainImg+'打印图片...')
							if(data.result.data == null) {
								mui.toast('没有更多商品')
							} else {
								var n = data.result.data.length;

								for(var i = 0; i < n; i++) {
									var b = data.result.data[i].mainImg;
//									console.log(b.indexOf(',') + '逗号索引值');
									var m = b.indexOf(',');
									if(m != '-1') {
										var mainImg = b.substring(0, m);
									} else {
										mainImg = b;
									}
									
									
									var div = $('<div class="categroy-signal"  id=' + data.result.data[i].id + '>'+
													'<div class="categroy-signal-con">'+
														'<div style="background-image: url(' + picur + mainImg + ');"></div>'+
														'<div>'+
															/*'<p class="categroy-name">' + data.result.data[i].shortname + '</p>'+*/
															'<p class="categroy-discor">' + data.result.data[i].longname + '</p>'+
															'<span class="price"><span class="pricereal pricereal'+i+'">' + (Math.round(data.result.data[i].price * 100) / 100).toFixed(2) + '</span><span class="decimal decimal'+i+'">00</span><span>元</span></span>'+
														'</div>'+
													'</div>'+
												'</div>');
									//									console.log(data.result.data[i].id + '////////');
									$('.categroy-wrap').append(div);
								var priDecimal = $('.pricereal'+i+'').text().split('.');
//								alert(priDecimal[0]);
								   $('.pricereal'+i+'').text(priDecimal[0]+'.');
								   $('.decimal'+i+'').text(priDecimal[1]);
								}
							}
//													plus.nativeUI.closeWaiting();
						},
						error: function() {
//													plus.nativeUI.closeWaiting();
						}
					});
				};
			

		$('.categroy-wrap').on('tap','.categroy-signal',function(){
//       	  alert(11);
            localStorage.whereId = $(this).attr('id');
         	   detail($(this).attr('id'));
        });
          
          
          function detail(even) {
				
				mui.openWindow({
					url: 'details.html',
					id: 'details'
				})
				//					})
			}

		</script>
	</body>

</html>